#pragma once

#include "MyGLUtils.h"
#include <string>
#include <unordered_map>
using namespace std;

class Shader
{
public:
	Shader(const string& shaderFile);
	~Shader();

	GLuint GetProgram() { return _program; }

	void Bind()const {
		glUseProgram(_program);
	}

	void Unbind()const {
		glUseProgram(0);
	}

	void SetUniformMat4(const string& name,const Matrix4x4f& mat);
	void SetUniform4f(const string& name, float x, float y, float z, float w);

private:
	void ParseGLSL(const string& codes);
private:
	string _vscode;
	string _fscode;
	GLuint _program = 0;

	unordered_map<string, GLint> _uniformLocs;
};

